package com.example.logic.chapter21;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;

public class Demo1 {
    public static void main(String[] args) throws IllegalAccessException {
        List<String> obj = Arrays.asList("老马", "编程");
        Class<? extends List> cls = obj.getClass();
        for (Field field : cls.getDeclaredFields()) {
            field.setAccessible(true);
            System.out.println("name --->" + field.getName() + "  " + field.get(obj));
        }
    }
}
